function[wines] = loadWines(filePath)
% Loads the wines from the given file.
%
%   INPUT
%   filePath....string specifying the path to the wine data file.
%   OUTPUT
%   wines.......A matrix containing the wines. The first line is the wine
%               id (1, 2 or 3), the following 13 lines represent the
%               following values: alcohol, malic acid, ash, alcalinity of
%               ash, magnesium, total phenols, flavanoids, nonflavanoid
%               phenols, proanthocyanins, color intensity, hue, OD280/OD315
%               of diluted wines, proline

    file = fopen(filePath);
    wines = fscanf(file, '%u,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f', [14,inf]);
    fclose(file);
    
    normalize_data=true;
    
    if (normalize_data)
        %normalize the data

        %map every statistic in range between 0 and 1

        %calculate the min/max
        mins = min(wines(2:end, :), [], 2);
        maxs = max(wines(2:end, :), [], 2);

        %normalize every value between 0 and 1 by value = (value - min) / (max - min) 

        delta = repmat(maxs - mins, 1, size(wines, 2));
        test = repmat(mins, 1, size(wines, 2));
        wines(2:end, :) = (wines(2:end, :) - test) ./ delta;
    end
end
